package com.ssms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssms.domain.Counsellor;
import com.ssms.mapper.CounsellorMapper;
import com.ssms.service.CounsellorService;
import com.ssms.utils.JwtUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
@Service
public class CounsellorServiceImpl extends ServiceImpl<CounsellorMapper, Counsellor> implements CounsellorService {
    @Override
    public String createToken(Counsellor counsellor) {
        Map tokenMap = new HashMap();
        tokenMap.put("id",counsellor.getId());
        tokenMap.put("number",counsellor.getNum());
        tokenMap.put("name",counsellor.getName());
        tokenMap.put("role",counsellor.getRole());
        String token = JwtUtils.getToken(tokenMap);
        return token;
    }
}
